package com.example.demo.factoryMethodModel;

/**
 * 女娲
 */
public class NvWa {

    public static void main(String[] args) {
        // 工厂方法 声明抽象类
//        AbstractHumanFactory humanFactory = new HumanFactory();
//        System.out.println("开始创造人");
//        BlackHuman blackHuman = humanFactory.createHuman(BlackHuman.class);
//        blackHuman.getColor();
//        blackHuman.talk();
//        YellowHuman yellowHuman = humanFactory.createHuman(YellowHuman.class);
//        yellowHuman.getColor();
//        yellowHuman.talk();
//        WhiteHuman whiteHuman = humanFactory.createHuman(WhiteHuman.class);
//        whiteHuman.getColor();
//        whiteHuman.talk();
        // 简单工厂模式
        BlackHuman blackHuman = HumanFactory1.createHuman(BlackHuman.class);
        blackHuman.getColor();
        blackHuman.talk();
        YellowHuman yellowHuman = HumanFactory1.createHuman(YellowHuman.class);
        yellowHuman.getColor();
        yellowHuman.talk();
        WhiteHuman whiteHuman = HumanFactory1.createHuman(WhiteHuman.class);
        whiteHuman.getColor();
        whiteHuman.talk();
    }
}
